﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using GalaSoft.MvvmLight.Threading;
using Srk.BetaseriesApiApp.ViewModels;
using Srk.BetaseriesApi;

namespace Srk.BetaseriesApiApp
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {

        public MainWindow() {
            InitializeComponent();
            DispatcherHelper.Initialize();
        }

        private void shows_MouseDoubleClick(object sender, MouseButtonEventArgs e) {
            if (lvSearchShows.SelectedItem != null) {
                tcMain.SelectedItem = tabInfo;
                Model.ShowInfo.Show = Model.ShowsSearch.SelectedShow;
            }
        }

        public Main Model {
            get { return DataContext as Main; }
        }

        private void LoginButton_Click(object sender, RoutedEventArgs e) {
            Model.Login.LoginCommand.Execute(pwLogin.Password);
        }

        private void TimelineControl_Loaded(object sender, RoutedEventArgs e)
        {

        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {

        }

        private void showMenu_Episodes_Click(object sender, RoutedEventArgs e) {
            if (lvSearchShows.SelectedItem != null) {
                tcMain.SelectedItem = tabInfo;
                Model.ShowInfo.Show = Model.ShowsSearch.SelectedShow;
            }
        }

        private void showMenu_Comments_Click(object sender, RoutedEventArgs e) {
            if (lvSearchShows.SelectedItem != null) {
                tcMain.SelectedItem = tabComments;
                Model.EpisodesComments.MyShow = Model.ShowsSearch.SelectedShow.Url;
            }
        }

        private void episodeMenu_Comments_Click(object sender, RoutedEventArgs e) {
            //if (lvEpisodes.SelectedItem != null) {
            //    var episode = lvEpisodes.SelectedItem as Episode;
            //    tcMain.SelectedItem = tabComments;
            //    Model.EpisodesComments.MyShow = Model.ShowsSearch.SelectedShow.Url;
            //    Model.EpisodesComments.MySeason = episode.Season;
            //    Model.EpisodesComments.MyEpisodeNB = episode.EpisodeNumber;
            //}
        }
    }
}
